package com.itheima.file;

import java.io.File;

public class 复制目录文件夹和文件 {
    public static void main(String[] args) {
        File src = new File("D:\\黑马视频\\file");
        File dest = new File("D:\\黑马视频\\filecopy");
        fileCopy(src, dest);
    }

    private static void fileCopy(File src, File dest) {
        dest = new File(dest, src.getName());
        if (!dest.isDirectory()) {
            dest.mkdirs();
        }
        File[] files = src.listFiles();
        if (files != null) {
            for (File file : files) {
                if (file.isDirectory()) {
                    fileCopy(file, new File(dest, file.getName()));
                } else {
                    File newDest = new File(dest, file.getName());
                }
            }
        }
    }
}
